<?php
  $dt = '31.00.2012';
  if( preg_match("/(\d\d)\.(\d\d).(\d\d\d\d)/", $dt, $d) && checkdate($d[2],$d[1],$d[3])) {
    echo $d[3].'-'.$d[2].'-'.$d[1];
  }
?>
